//
//  ESUILabel.m
//  Founder_study
//
//  Created by hongbao.cui on 14-8-8.
//  Copyright (c) 2014年 com.founder. All rights reserved.
//

#import "ESUILabel.h"
#import "ApplicationUtils.h"
@implementation ESUILabel

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code
//        UITapGestureRecognizer *singleFingerOne = [[UITapGestureRecognizer alloc] initWithTarget:self
//                                                    action:@selector(handleSingleFingerEvent:)];
//        singleFingerOne.numberOfTouchesRequired = 1; //手指数
//        singleFingerOne.numberOfTapsRequired = 1; //tap次数
//         [self addGestureRecognizer:singleFingerOne];
//        _lineLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, self.frame.size.height-1, self.frame.size.width, 1)];
//        [self addSubview:_lineLabel];
//        [_lineLabel setBackgroundColor:[UIColor colorWithRed:48/255.0 green:164/255.0 blue:225/255.0 alpha:1.0]];
//        [self setTextAlignment:NSTextAlignmentLeft];
//        [self setTextColor:[UIColor blackColor]];
//        [self setFont:[UIFont systemFontOfSize:13.0]];
//        self.userInteractionEnabled = YES;
        UIImage *bgImage1 = [[ApplicationUtils getLocalImage:@"card_btn_normal"] resizableImageWithCapInsets:UIEdgeInsetsMake(10, 10, 10, 10)];
        UIImage *bgImage2 = [[ApplicationUtils getLocalImage:@"card_btn_hover"] resizableImageWithCapInsets:UIEdgeInsetsMake(10, 10, 10, 10)];
        [self setBackgroundImage:bgImage1 forState:UIControlStateNormal];
        [self setBackgroundImage:bgImage2 forState:UIControlStateHighlighted];
        [self addTarget:self action:@selector(handleSingleFingerEvent:) forControlEvents:UIControlEventTouchUpInside];
        [self setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        [self setTitleColor:[UIColor whiteColor] forState:UIControlStateHighlighted];
    }
    return self;
}
-(void)handleSingleFingerEvent:(UITapGestureRecognizer *)gesture{
    if (_delegate!=nil&&[_delegate respondsToSelector:@selector(btnClicked:)]) {
        [_delegate btnClicked:_exerciseDict];
    }
}
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
//- (void)drawRect:(CGRect)rect
//{
//    // Drawing code
//    if (_lineLabel) {
//        [_lineLabel setFrame:CGRectMake(0, self.frame.size.height-1, self.frame.size.width, 1)];
//    }
//}


@end
